#include <REGX52.H>
#include "LCD1602.h"
#include "delay.h"

unsigned char n=0;
unsigned int password,count;
void main(){
	LCD_Init();
	LCD_ShowString(1,1,"Password");
	while (1){
		n=Mstrixkey();
		if(n){
			if(n<=10){
				if(count<4){
					password*=10;
				password+=(n%10);
				LCD_ShowNum(2,1,password,4);
				}
				count++;
			}
		if(n==11){
			if(password==1122)
				LCD_ShowString(1,14,"ok " );
			else
				LCD_ShowString(1,14,"off");
		}
		if(n==11||n==12){
			password=0;
			count=0;
			LCD_ShowNum(2,1,password,4);
		}
		}
	}
}